package com.hzdesk.media.koreabatchmatvector.logic.view;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.hzdesk.media.koreabatchmatvector.R;
import com.hzdesk.media.koreabatchmatvector.adapter.SettingNetWorkAdapter;
import com.hzdesk.media.koreabatchmatvector.adapter.WiFiSettingAdapter;
import com.hzdesk.media.koreabatchmatvector.inter.OnclikedWiFiSetting;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2018/8/2.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 */

class SettingNetWorkActivity extends BaseActivity {


    @BindView(R.id.activity_setting_net_work_recyclerview)
    RecyclerView activitySettingNetWorkRecyclerview;
    @BindView(R.id.activity_setting_net_work_bg)
    LinearLayout activitySettingNetWorkBg;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting_net_work);
        ButterKnife.bind(this);

        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        activitySettingNetWorkRecyclerview.setLayoutManager(layoutManager);
        SettingNetWorkAdapter       madapter = new SettingNetWorkAdapter();
        activitySettingNetWorkRecyclerview.setAdapter(madapter);
        madapter.setmOnclikedWiFiSetting(new OnclikedWiFiSetting() {
            @Override
            public void onClickedItem(int postion) {
                    toPager(postion);
            }
        });
    }

    private void toPager(int postion) {

        switch (postion){
            case 0:
                toOtherPager(WiredNetworkSettingsActivity.class);
                break;
            case 1:
                toOtherPager(WiFiSettingActivity.class);
                break;
            case 2:
                toOtherPager(WifiHotActivity.class);
                break;
        }
    }
    // 页面跳转
    private void toOtherPager(Class<?> cls) {
        startActivity(new Intent(SettingNetWorkActivity.this, cls));
    }
    @Override
    protected void onStart() {
        super.onStart();
        final SharedPreferences mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
        int selector = mSharedPreferences.getInt("item_skin", 0); //todo 名称
        activitySettingNetWorkBg.setBackgroundResource(updateBg[selector]);
    }


}
